﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using D2.Pathfinder.Data;
using Common.MVVM.Core.Base;

namespace D2.PathfinderHub.ViewModel
{
    public class CharacterSheetViewModel : ViewModelBase<Character>
    {
        public CharacterManagerViewModel Manager { get; protected set; }

        public CharacterSheetViewModel(Character model, CharacterManagerViewModel manager)
        {
            Model = model;
            Manager = manager;
        }

        public string CharacterName
        {
            get { return Model.Name; }
            set
            {
                if (Model.Name == value) return;
                Model.Name = value;
                OnPropertyChanged("CharacterName");
            }
        }

        public string PlayerName
        {
            get { return Model.Player; }
            set
            {
                if (Model.Player == value) return;
                Model.Player = value;
                OnPropertyChanged("PlayerName");
            }
        }

        private AlignmentViewModel _Alignment;
        public AlignmentViewModel Alignment
        {
            get
            {
                if (_Alignment == null)
                    _Alignment = (AlignmentViewModel)SettingsManager.Lists[typeof(AlignmentViewModel)][Model.Alignment];
                return _Alignment;
            }
            set
            {
                if (_Alignment == value) return;
                _Alignment = value;
                OnPropertyChanged("Alignment");
            }
        }

    }
}
